package com.codes.core.common.enumtype.wordtpl;


/****
 * @Description    模板类型 对应 数据库表
 * @Date 2020/7/4 15:11
 * @Created by peanut
 */
public enum TplTableMappingEnum {


    /**
     *
     */

    zhandianxinxi(1,"站点信息监测表"),
    liandengji(2,"立案登记表"),
    chuliyijian(3,"案件处理意见"),
    xunwenbilu(4,"询问笔录"),
    weifaxingwei(5,"违法行为通知"),
    songdahuizheng(6,"送达回证"),
    chenshu(7,"陈述申辩"),
    jieanbaogao(8,"结案报告"),




    end(999999 ,"最后的莫西干人");




    /** code */
    private int code;

    /** 显示标签 */
    private String label;

    /**
     * 构造器，必须私有
     * @param code
     */
    TplTableMappingEnum(int code, String label){
        this.code = code;
        this.label = label;
    }

    /**
     * 获取code的文本
     * @param code
     * @return
     */
    public static String getLabelByCode (int code){
        for (TplTableMappingEnum enuma : TplTableMappingEnum.values()){
            if (enuma.getCode() == code){
                return enuma.getLabel();
            }
        }
        return "未知枚举项";
    }
    /**
     * 根据文本获取code
     */
    public static int getCodeByLabel(String label){
        for(TplTableMappingEnum enuma : TplTableMappingEnum.values()){
            if(enuma.getLabel().equals(label)){
                return enuma.getCode();
            }
        }
        return -1;

    }

    /**
     * 根据code获取枚举
     */
    public static TplTableMappingEnum getRoleByCode(int code){
        for(TplTableMappingEnum enuma : TplTableMappingEnum.values()){
            if(enuma.getCode() == code){
                return enuma;
            }
        }
        return null;
    }

    public String toString(){
        return label;
    }

    public String getLabel() {
        return label;
    }

    public int getShort(){
        return this.code;
    }

    public int getCode(){
        return this.code;
    }


}
